<?php
namespace App\Models\Trade\Common;

use Illuminate\Support\Facades\DB;
use App\Models\Model;

class FishKindUnitSizeModel extends Model
{

    const TABLENAME = 'tw_trade_fish_kind_unit_size';

    /**
     * 查询列表（品种 ID）
     *
     * @param int $kindId
     * @return \Illuminate\Support\Collection
     */
    public static function selectByKindId($kindId)
    {
        return self::dbTable('d')->select(DB::raw('uz.id,uz.name'))
            ->leftJoin(FishUnitSizeModel::TABLENAME . ' as uz', 'uz.id', '=', 'd.unit_size_id')
            ->where('d.kind_id', $kindId)
            ->get();
    }
}
